<template>
  <div class="app-container calendar-list-container">
    <div class="w-body">
      <div class="w-table">
        <grid gridTitle="工艺流程" :columns="stepColumns" :url="stepUrl" ref="mainGrid" height="auto" diffHeight="150" :pagination="false" :permissions="permissions" @prod="doProd"
          :queryEntity="queryEntity"></grid>
      </div>
    </div>
  </div>
</template>
<script>
import request from '@/router/axios'
import { Message, MessageBox } from 'element-ui'
import url from '@/const/apiURL'
import GridDialog from '@/components/GridDialog'
import grid from '@/components/Grid'
import { mapGetters } from 'vuex'
import { queryField } from '@/const/query'
import { colunms } from '@/const/colunms'


export default {
  components: { GridDialog, grid },
  data () {
    return {
      stepUrl: url.ORDER_STEP_QUERY_URL,
      orderNo: '',
      queryEntity: {
        materialCode: '',
        goodsCode: '',
      },
      stepColumns: [
        { label: '工序名称', width: 160, prop: 'stepName', align: 'left' },
        { label: '入库仓库', width: 160, prop: 'inWarehouseName', align: 'center' },
        { label: '出库仓库', width: 160, prop: 'outWarehouseName', align: 'center' },
        { label: '顺序', width: 60, prop: 'indexSort', align: 'center' },
        {
          label: '操作', width: 120, prop: 'op', align: 'center', template: 'op', opList: [
            { name: '生产', clickName: 'prod', auth: 'business_prod', showFomatter: function (row) { return row.orderStatus == 0 } }
          ]
        }
      ]
    }
  },
  created () {
    this.queryEntity.materialCode = this.$route.query.goodsCode
    this.queryEntity.goodsCode = this.$route.query.goodsCode
    this.orderNo = this.$route.query.orderNo
  },
  computed: {
    ...mapGetters(['permissions'])
  },
  methods: {
    doProd (row) {
      this.$router.push({ path: '/prod/business', query: { orderNo: this.orderNo, goodsCode: this.queryEntity.goodsCode, code: row.code } })
    }
  }
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.w-body {
  padding-top: 8px;
}
.w-table {
  border: 1px solid #ebeef5;
}
.w-table-title {
  border: 1px solid #ebeef5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-all;
  line-height: 23px;
  display: inline-block;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  position: relative;
  vertical-align: middle;
  width: 100%;
  font-size: 14px;
  color: gray;
}
</style>
